<!doctype html>
<html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
<head>
<meta charset=UTF-8" pageEncoding="UTF-8">
<title>代理商绑定</title>
	<meta name="viewport" id="viewport" content="width=device-width, initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<!--说明：网站开启对web app程序的支持。-->
	<meta name="apple-mobile-web-app-status-bar-style" content="black" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" >
	<meta name="format-detection" content="telephone=no" >
	<!--
	说明：
	在web app应用下状态条（屏幕顶部条）的颜色； 
	默认值为default（白色），可以定为black（黑色）和black-translucent（灰色半透明）。 
	注意：若值为“black-translucent”将会占据页面px位置，浮在页面上方（会覆盖页面20px高度–iphone4和itouch4的Retina屏幕为40px）。
	-->
</head>

<body>



<style>
	*{color: #333;}
	html, body, div, span, object, iframe,  h1, h2, h3, h4, h5, h6, p, blockquote, pre,  abbr, address, cite, code,  del, dfn, em, img, ins, kbd, q, samp,  small, strong, sub, sup, var,  b, i,  dl, dt, dd, ol, ul, li,  fieldset, form, label, legend,  table, caption, tbody, tfoot, thead, tr, th, td,  article, aside, canvas, details, figcaption, figure,  footer, header, hgroup, menu, nav, section, summary,  time, mark, audio, video {margin: 0;padding: 0;border: 0;outline: 0;font-size: 100%;vertical-align: baseline;background: transparent;}
	body {line-height: 1;background-color: #f7f7f7;}
	:focus {outline: 1;}
	article, aside, canvas, details, figcaption, figure,  footer, header, hgroup, menu, nav, section, summary {display: block;}
	ul {list-style: none;}
	blockquote, q {quotes: none;}
	blockquote:before, blockquote:after,  q:before, q:after {content: '';content: none;}
	a {margin: 0;padding: 0;border: 0;font-size: 100%;vertical-align: baseline;background: transparent;text-decoration: none;color: #333;display: block;}
	ins {background-color: #ff9;color: #000;text-decoration: none;}
	mark {background-color: #ff9;color: #000;font-style: italic;font-weight: bold;}
	del {text-decoration: line-through;}
	abbr[title], dfn[title] {border-bottom: 1px dotted #000;cursor: help;}
	table {border-collapse: collapse;border-spacing: 0;}
	hr {display: block;height: 1px;border: 0;border-top: 1px solid #cccccc;margin: 1em 0;padding: 0;}
	input, select {vertical-align: middle;}
	.fl {float: left;}
	.fr {float: right;}
	html, body {min-height: 100%;min-width: 100%;font-family: '微软雅黑';font-size: calc(100vw / 7.5);}
	body{padding: 1px 0;font-size: 0.24rem;padding: 1.1rem 0 1.25rem;}
	input, textarea {border: none;}
	button,input{border: none;margin: 0;padding: 0;outline: none;background: none;}
	/*过渡动画*/
	.tra{
			transition: all .3s linear;
	   -moz-transition: all .3s linear;
	-webkit-transition: all .3s linear;
		 -o-transition: all .3s linear;
	}
	.clear{clear: both;}
	/*通用显示*/
	.displayblock{display: block;}

	input:focus-visible{
		outline: none;
	}

	.tijiao{
		width: 90vw;
/*		height: 60vw;*/
		position: fixed;
		left: 5vw;
		top: 30vh;
		background-color: #fff;
		border-radius: 0.2rem;
		padding: 0.4rem 0 0 0;
	}
	.sl1,.sl2{
		display: flex;
		align-content: center;
		align-items: center;
		width: 75%;
		justify-content: space-between;
		margin: 0 auto 0.2rem
	}
	.sl2{
	}
	.sl1 span{
		display: block;
		flex: 0 0 auto;
		padding: 0 0.2rem 0 0;
	}
	.sl1 input,.sl2 input{
		flex: 1;
		display: block;
		height: 0.6rem;
		border-bottom: 1px solid #eee;
	}
	.sl2 span{
		display: block;
		flex: 0 0 auto;
		padding: 0 0.2rem 0 0;
	}
	.sl2 input{
		width: 0.3rem;
	}
	.sl2 .hq{
		display: block;
		flex: 0 0 auto;
		width: 1.6rem;
		height: 0.6rem;
		text-align: center;
		background-color: #00a6ff;
		display: flex;
		justify-content: center;
		align-content: center;
		align-items: center;
		color: #fff;
		font-size: 0.24rem;
		line-height: 0.24rem;
	}
	
	.tjs{
		display: flex;
		width: 40%;
		background-color: #0083ff;
		justify-content: center;
		align-content: center;
		align-items: center;
		height: 0.7rem;
		font-size: 0.33rem;
		line-height: 0.33rem;
		margin: 0.6rem auto;
		color: #fff;
		border-radius: 0.2rem;
	}
</style>











<div class="tijiao">
	<div class="sl1">
		<span>手机号</span>
		<input maxlength="11" class="sjh" type="number">
	</div>
	<div class="sl2">
		<span>验证码</span>
		<input class="yzm" type="number">
<!--		<div class="hq">获取验证码</div>-->
		<input class="hq" type="button" id="btn" value="获取验证码" onclick="settime(this)" />
	</div>
	<div style="display:none;">
		<input class="openid" name="openid" value="${openid}">
	</div>
	<button class="tjs">提交</button>
	
</div>





<script src="/js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
<script>
var countdown = 60;
function settime(obj) {
	if (countdown == 0) {
		obj.removeAttribute("disabled");
		obj.value="获取验证码";
		countdown = 60;
		return;
	} else {
//		console.log("数据")
//		var asd1 = $(".sjh").val()
//		if(asd1.length == 11){
//			$.post("http://app.banxma.com/sendSmsCode.json",{"phone":asd1},
//			function(data,status){
//				console.log(status)
//				console.log(data)
//			});
//		}else{
//			alert("请输入正确的手机号");
//		}
		obj.setAttribute("disabled", true);
		obj.value="重新发送(" + countdown + ")";
		countdown--;
	}
	setTimeout(function() {
		settime(obj)
	},1000)
}
	$(document).ready(function(){
//		$(".hq").click(function(){
//			console.log("数据")
//			var asd1 = $(".sjh").val()
//			if(asd1.length == 11){
//				$.post("http://app.banxma.com/sendSmsCode.json",{"phone":asd1},
//				function(data,status){
//					console.log(status)
//					console.log(data)
//				});
//			}else{
//				alert("请输入正确的手机号");
//			}
//		});
		$(".tjs").click(function(){
			console.log("数据")
			var asd1 = $(".sjh").val()
			var asd2 = $(".yzm").val()
			var asd3 = $(".openid").val()
			if(asd1.length == 11){
				if(asd2.length == 6){
//					$.post("http://app.banxma.com/entry.do",{},
//					function(data1,status1){
//						console.log(status1)
//						console.log(data1) 
						var osp = {
							"openid" : asd3,
							"phone" : asd1,
							"code" : asd2,
						}
						$.post("http://app.banxma.com/relationPublicDlsOpenid.json",osp,
						function(data,status){
							console.log(status)
							console.log(data)
							if(data.result == 1){
								alert("提交成功");
								document.addEventListener('WeixinJSBridgeReady', function() {
								WeixinJSBridge.call('closeWindow');
									}, false);
								WeixinJSBridge.call('closeWindow');
							}else{
								alert(data.info);
								document.addEventListener('WeixinJSBridgeReady', function() {
								WeixinJSBridge.call('closeWindow');
									}, false);
								WeixinJSBridge.call('closeWindow');
							}
						});
//					});

				}else{
					alert("请输入正确的验证码");
				}
			}else{
				alert("请输入正确的手机号");
			}
			console.log(asd1)
			console.log(asd2)

		});

	});
	$(".hq").click(function(){
		console.log("数据")
		var asd1 = $(".sjh").val()
		if(asd1.length == 11){
			$.post("http://app.banxma.com/sendSmsCode.json",{"phone":asd1},
			function(data,status){
				console.log(status)
				console.log(data)
			});
		}else{
			alert("请输入正确的手机号");
		}
	});

</script>

</body>
</html>
